<template>
    <!--课程详情弹窗-->
    <el-dialog
        :visible.sync="showCourseDialog"
        :title="language=='en'?'Course':'查看课程'"
        width="50%"
        append-to-body
        @close="cancelDialog"
    >
        <div class="modal-body">
            <el-row>
                <el-col :span="12">
                    <label class="secondary-text label">{{ $t('course.courseCode',language)+"：" }}</label>
                    <span class="majoy-tex span">{{ couseDetail.code }}</span>
                </el-col>
                <el-col :span="12">
                    <label class="secondary-text label">{{ $t('course.courseName',language)+ "：" }}</label>
                    <span class="majoy-tex span">{{ language=='en'?couseDetail.nameEn:couseDetail.name }}</span>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <label class="secondary-text label">{{ $t('label.totalWeek',language)+ "：" }}</label>
                    <span class="majoy-tex span">{{ couseDetail.weeks }}</span>
                </el-col>
                <el-col :span="12">
                    <label class="secondary-text label">{{ $t('label.weekHour',language)+ "：" }}</label>
                    <span class="majoy-tex span">{{ couseDetail.week_hour }}</span>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <label class="secondary-text label">{{ $t('course.period',language)+ "：" }}</label>
                    <span class="majoy-tex span">{{ couseDetail.period }}</span>
                </el-col>
                <el-col :span="12">
                    <label class="secondary-text label">{{ $t('course.score',language)+ "：" }}</label>
                    <span class="majoy-tex span">{{ couseDetail.credits }}</span>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <label class="secondary-text label">{{ $t('label.trainingLevel',language)+ "：" }}</label>
                    <span class="majoy-tex span">{{ couseDetail.trainingLevelI18n }}</span>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12" class="textCont">
                    <label class="secondary-text label">{{ $t('course.introCn',language)+ "：" }}</label>
                    <el-tooltip :content="language == 'en' ? (couseDetail.engIntroductionCourse || couseDetail.introductionCourse) : couseDetail.introductionCourse" placement="bottom-start" effect="light">
                        <span class="majoy-tex span">{{ language == 'en' ? (couseDetail.engIntroductionCourse || couseDetail.introductionCourse) : couseDetail.introductionCourse }}</span>
                    </el-tooltip>
                </el-col>
            </el-row>
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button @click="cancelDialog">{{ $t("message.close",language) }}</el-button>
        </div>
    </el-dialog>
</template>
<script>
export default {
    name: 'CourseDetail',
    props: {
        couseDetail: {
            type: Object,
            required: true
        },
        showCourseDialog: {
            type: Boolean,
            required: true,
            default: false
        },
        lang: {
            type: String,
            required: true,
            default: ''
        }
    },
    computed: {
        language() {
            if(this.lang){
                return this.lang
            }else{
                return this.$store.getters.language
            }
        }
    },
    methods: {
        cancelDialog() {
            this.$emit('closeCourseDialog')
        }
    }
}
</script>
<style>
.modal-body .el-row{
    height: 32px;
    line-height: 32px;
}
.modal-body .el-row label{
    width:  150px;
    text-align: right;
    display: inline-block;
}
.modal-body .el-row .textCont{
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
</style>
